package com.kiwi.util;

import java.util.Random;

public class CommonUtil {
    private static String[] CANDIDATECHAR;
    public static String generateRandomCode(int length) {
        Random r = new Random(System.currentTimeMillis());
        StringBuilder resultstr = new StringBuilder("");

        for(int i = 0; i < length; ++i) {
            int tmp = r.nextInt(CANDIDATECHAR.length);
            resultstr.append(CANDIDATECHAR[tmp]);
        }

        return resultstr.toString();
    }
}
